<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>社团活动管理</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList"/>
		<input type="hidden" id="bodyData" name="bodyData" value=""/>
	<%@ include file="/module/orderField.jsp"%>
		<table cellpadding="1" cellspacing="1" border="0">
			<tr>
				<td><input type="button" id="btnQuery" value="查询"
					class="inputButton" /></td>
			     <td><input type="button" id="btnExport" value="导出"
					 class="inputButton"/></td>
					 
			</tr>
		</table>
		<table cellpadding="1" cellspacing="1">
			  <tr>
			    <td>社团：</td>
				<td><select id="stid" name="stid" class="selectList">
					     <option value="">全部</option>
				         <c:forEach items="${liststmc}" var="data">
						      <option value="${data.stid}">${data.stmc}</option>
					     </c:forEach>
				</select></td>&nbsp;&nbsp;
		    	<td>活动名称：</td>
				<td><input type="text" name="hdmc"  id="hdmc"  placeholder="请输入"   autocomplete="off"   class="inputText"/></td>&nbsp;&nbsp;
			</tr>
			<tr>	
				<td>申请人：</td>
				<td><input type="text" name="creatorname"  id="creatorname"  placeholder="请输入"   autocomplete="off"   class="inputText"/></td>&nbsp;&nbsp;
				<td>活动日期：从</td>
				<td><input name="beginTime1" id="beginTime1" placeholder="请输入"   autocomplete="off"  
									class="Wdate  text inputText2" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>&nbsp;到
		             <input name="endTime1" id="endTime1" placeholder="请输入"   autocomplete="off"   
									class="Wdate  text inputText2" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>		
			</tr>
		</table>
		</br>
     <table id="dg"  style="width:100%;"
		data-options="pagination:true,collapsible:true,url:'${basePath}/twglStudentCorpActivity/List_admin',method:'post',remoteSort:true,striped:true">
		<thead>
			<tr>
				<th data-options="field:'hdmc',sortable:true,nowrap:true,width:250,align:'left',formatter:formUrl">活动名称</th>
				<th data-options="field:'hdrq',sortable:true,nowrap:true,width:250,align:'left',formatter:formatDate">活动日期</th>
				<th data-options="field:'hdsj',sortable:true,nowrap:true,width:250,align:'left'">活动时间</th>
				<th data-options="field:'hddd',sortable:true,nowrap:true,width:400,align:'left'">活动地点</th>
				<th data-options="field:'stmc',sortable:true,nowrap:true,width:250,align:'left'">社团名称</th>
				<th data-options="field:'zdlsxm',nowrap:true,width:180,align:'left',sortable:true">指导老师</th>
				<th data-options="field:'szxm',nowrap:true,width:186,align:'left',sortable:true">社长</th>
				<th data-options="field:'creatorname',nowrap:true,width:186,align:'left',sortable:true">申请人</th>
				<th data-options="field:'createtime',nowrap:true,width:186,align:'left',sortable:true,formatter:formatDate1">申请时间</th>
			</tr>
		</thead>
	</table>
</form>	
		

		<script type="text/javascript">
		
	     function formUrl(value,row, index){
			   return "<a href='${basePath}/twglStudentCorpActivity/registration_admin?id=" + row.hdid + "'>" + value + "</a>";
		  }   
		
		   
	    function formatDate(value){
	    	if(value!=null){
	    		var date=new Date(value);
				var y = date.getFullYear();
				var m = date.getMonth()+ 1;
				var d = date.getDate();
				var h= date.getHours();       //获取当前小时数(0-23)
				var mm= date.getMinutes();     //获取当前分钟数(0-59)
				var s= date.getSeconds();     //获取当前秒数(0-59)
				return y +'-'+(m <10?('0'+ m):m)+'-'+(d <10?('0'+ d):d)+'';
	    	}else{
	    		return "";
	    	}
		}
	    
	    
	    function formatDate1(value){
	    	if(value!=null){
	    		var date=new Date(value);
				var y = date.getFullYear();
				var m = date.getMonth()+ 1;
				var d = date.getDate();
				var h= date.getHours();       //获取当前小时数(0-23)
				var mm= date.getMinutes();     //获取当前分钟数(0-59)
				var s= date.getSeconds();     //获取当前秒数(0-59)
				return y +'-'+(m <10?('0'+ m):m)+'-'+(d <10?('0'+ d):d)+' :'+(h <10?('0'+ h):h)+':'+(mm <10?('0'+ mm):mm)+'';
	    	}else{
	    		return "";
	    	}
		}
	    
		    
			$(document).ready(
							function() {
						
					         	$('#dg').datagrid({
								/*  onSortColumn :function(sort,order){
								   var _sort=sort;
								   var _order=order;
								   var options=$('#dg').datagrid('getPager').data("pagination").options;
								   var page=options.pageNumber;
								   var pageSize=options.pageSize;
								   window.setTimeout(function(){
									   $.post("${basePath}/twglStudentCorpActivity/List_admin",{orderFlag:_order,orderField:_sort,
										    creatorname: $('#creatorname').val(),
											stid: $('#stid').val(),
											hdmc: $('#hdmc').val(),
											beginTime1: $('#beginTime1').val(),
											endTime1:$('#endTime1').val()},
											function(data){
												  $('#dg').datagrid("loadData",data); 
											   });
											   },100);  
								   },
								   rowStyler: function(index,row){
								   } */
								});
								//查询
								$('#btnQuery')
										.click(
												function() {
													$('#dg').datagrid('load',{
														    creatorname: $('#creatorname').val(),
															stid: $('#stid').val(),
															hdmc: $('#hdmc').val(),
															beginTime1: $('#beginTime1').val(),
															endTime1:$('#endTime1').val()
													});
												});
								
							

								
						     	$('#btnExport').on('click', function(){
									   layer.confirm("您确定要导出吗?", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
										   var rows = $("#dg").datagrid("getRows");
										        $("#bodyData").val(JSON.stringify(rows));
											    document.Form.action = "${basePath}/twglStudentCorpActivity/export_admin";
												document.Form.submit();
												layer.close(index);
					            		 });
									}); 
								
							
								
						     	});
			
			
			  if("${msg}"!=""){
			       layer.alert("${msg}", {icon: 6});
			  } 
		</script>
	
</body>
</html>
